package com.rskj.cashbook.vo;

import lombok.Data;

import java.util.List;

/**
 * 账单类型DTO
 */
@Data
public class BillTypeDTO {
    private String id;
    private String code;
    private String name;
    private String description;
    private String category;
    private String icon;
    private String color;
    private Integer sort;
    private Boolean enabled;
    private String remark;
    
    public BillTypeDTO() {}
    
    public BillTypeDTO(Dict dict) {
        this.id = dict.getId();
        this.code = dict.getCode();
        this.name = dict.getName();
        this.description = dict.getDescription();
        this.category = dict.getCategory();
        this.icon = dict.getIcon();
        this.color = dict.getColor();
        this.sort = dict.getSort();
        this.enabled = dict.getEnabled();
        this.remark = dict.getRemark();
    }
    
    /**
     * 判断是否为支出类型
     */
    public boolean isExpense() {
        return "EXPENSE".equals(this.category);
    }
    
    /**
     * 判断是否为收入类型
     */
    public boolean isIncome() {
        return "INCOME".equals(this.category);
    }
    
    /**
     * 判断是否为借贷类型
     */
    public boolean isLoan() {
        return "LOAN".equals(this.category);
    }
    
    /**
     * 判断是否为转账类型
     */
    public boolean isTransfer() {
        return "TRANSFER".equals(this.category);
    }
}
